package code;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;

public class Ordinal_NonPositiveTestSet {

	/**
	 * @param args
	 */
	public static void main(String[] args) throws IOException {
		
		BufferedReader br = new BufferedReader(new FileReader("C:\\Users\\mtnguyen.2012\\Downloads\\svm_light_windows (1)\\ordinal_classifier\\fold-1\\output00"));
		
		BufferedReader br2 = new BufferedReader(new FileReader("C:\\Users\\mtnguyen.2012\\Downloads\\svm_light_windows (1)\\ordinal_classifier\\fold-1\\test00_"));
		
		BufferedWriter bw = new BufferedWriter(new FileWriter("C:\\Users\\mtnguyen.2012\\Downloads\\svm_light_windows (1)\\ordinal_classifier\\fold-1\\test00-2"));
		
//		int numRows = 200042;
		int numRows = 768668;
		int lineNum = 0;		
		int numPos = 0;
		int numNonPos = 0;
		
		String line = null;
		while(lineNum < numRows){
			line = br.readLine();
			double cls = Math.signum(Double.parseDouble(line));
			line = br2.readLine();
			if(cls < 0.0) {
				numNonPos++;
				bw.write(line+"\n");
			}
			else {
				numPos++;
			}
			lineNum++;
		}
		
		br.close();
		
		br2.close();
		
		bw.close();
		
		System.out.println("Number of pos " + numPos);
		System.out.println("Number of non-pos " + numNonPos);
		System.out.println("Total " + (numPos+numNonPos));
	}

}
